<template>
	<div class="login">
	  <div class='login-t'>绑定帐号</div>
	  <div class='login-c'>
		<div class='login-item'>
		  <text>账号：</text><input bindinput='getTel' type='number' v-model="telephone"  placeholder='请输入您的账号'  ></input>
		</div>
		 <div class='login-item'>
		  <text>密码：</text><input bindinput="getpassword"  type='text' v-model="password"  password="true"  placeholder='请输入密码'></input>
		</div>
	  </div>
	  <div class='login-btn'  @click='bconfirm'>确定</div>
	</div>

</template>

<script>
	import {get} from '../../utils/index'
	export default{
		data() {
			return{
				telephone:'',
				password:''
			}
			
		},
		methods:{
			async bconfirm(){
				var datas ={
					phone: this.telephone,
					password: this.password,
					appOpenid: wx.getStorageSync('kyboppenid'),
				}
				const res = await get('bindAgent',datas)
				
				console.log(res);
				if(res.code == 500){
					wx.showToast({
                        title: res.msg,
                        icon: 'none'
                    })
					this.telephone =''
					this.password=''
				}else if(res.code == 0){
					wx.setStorageSync('userDo', res.userDO)	
					wx.showToast({
                        title: "绑定成功！"

                    })
                    setTimeout(function () {
                        wx.switchTab({
                            url: '/pages/home/main',
                        })
                    }, 1000)
				}
			}
		}
	}
</script>

<style>
	/* pages/login/login.wxss */
page{
  background: #f6f6f6
}
.login-t{
  height: 80rpx;
  line-height: 80rpx;
  background: #fff;
  box-shadow: 0 3rpx 10rpx #ccc; 

  font-size: 30rpx;
  text-align: center;
}
.login-c{
  font-size: 28rpx;
  background: #fff;
 
  margin: 30rpx auto;
  padding: 40rpx 15rpx;

}
.login-item{
  display: flex;
  height: 80rpx;
  line-height: 80rpx;
  border-bottom: 2rpx solid #ccc;
}
.login-item text{
  width: 136rpx;
}
.login-item input{
  vertical-align: middle;
  margin-top: 16rpx;
  flex: 1
}
.login-btn{
  width: 90%;
  height: 80rpx;
  line-height: 80rpx;
  background: #333;
  color: #fff;
  text-align: center;
  margin: 20rpx auto;
  font-size: 30rpx;
}
	
</style>